<?php
/**
 * 退款模型
 * User: lxq
 * Date: 2018/4/23
 * Time: 17:24
 */
class order_refundModel extends Model {

    public $status = array('0'=>'待处理', '1'=>'已同意', '2'=>'已拒绝');
    public $pay_type = array('1'=>'微信支付','2'=>'支付宝','3'=>'手动确认收款');
    public function __construct()
    {
        parent::__construct('order_refund');
    }

    /**
     * 获取列表分页
     * @param array $condition
     * @param string $field
     * @param int $page
     * @param string $order
     * @return mixed
     */
    public function getOrderRefundListPage($condition = array(), $field = '*', $page = 0, $order = 'id desc'){
        return $this->field($field)->where($condition)->page($page)->order($order)->select();
    }

    /**
     * 获取一条记录的详细信息
     * @param array $condition
     * @param string $field
     * @return mixed
     */
    public function getOrderRefundInfo($condition = array(), $field = '*')
    {
        return $this->field($field)->where($condition)->find();
    }


    /**
     * 插入一条记录
     * @param array $params
     * @return mixed
     */
    public function addOrderRefund($params)
    {
        return $this->insert($params);
    }

    /**
     * 更新记录
     * @param array $condition
     * @param array $params
     * @return mixed
     */
    public function updateOrderRefund($condition, $params)
    {
        return $this->where($condition)->update($params);
    }

    /**
     * 统计
     * @param array $condition
     */
    public function getOrderRefundCount($condition)
    {
        return $this->where($condition)->count();
    }
    /**
     * 获取记录数组
     * @param array $condition
     * @param string $field
     * @param string $order
     * @return mixed
     */
    public function getOrderRefundList($condition = array(), $field = '*', $order = 'id desc'){
        return $this->field($field)->where($condition)->order($order)->select();
    }
}